home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-23 | 2.9 KB | 106 lines | [TEXT/ttxt] |
- X-Sender: chewey@nesw.mv.com (Unverified)
- Mime-Version: 1.0
- Date: Tue, 5 Jul 1994 22:08:25 -0500
- To: Hugh.Fisher@anu.edu.au
- From: chewey@nesw.MV.COM (Matthew E. Axsom)
- Subject: Slideoff
-
- Hugh,
-
- Sorry for taking so long to get back to you. I added 2 lines of code to
- your slideoff routine so that it now looks for the next menu insertion
- point and uses that as it's sliding point. Hopefully this should keep
- clocks and other extra system menu beasties from sliding w/the apps menus.
-
- The code is in C (straight out of my app library). If you have any
- questions about the code or how it works (should be pretty straight
- forward) let me know. There is a way to detect the left edge of the system
- menus, but then you would have to look for the clock. Using the next menu
- insertion point should work pretty well.
-
- If I have any spare time I might write an init to do this in all app.
- Might even be able to slide off the old and slide in the new. Maybe ;->
-
- Thanks again for reviving this interface concept.
-
- Cheers,
-
- -Chewey
-
-
-
- Content-Type: text/plain; name="Slideoff.c"; charset="us-ascii"
- Content-Disposition: attachment; filename="Slideoff.c"
-
- #define LMGetMenuList() (* (Handle *) 0x0A1C)
-
- // these are my own data structures for parsing the menu list
- typedef struct {
- MenuHandle mh;
- short startLeft; // Position from the left where this menu starts
- }menuRec,*menuRecPtr,**menuRecHand;
-
- typedef struct {
- short size; // div sizeof(menuRec) for number of items
- short nextLeft; // where next menu will go
- short filler; // just junk
- menuRec item[]; // a list of the above
- }menuListRec,*menuListPtr,**menuListHand;
-
- static void slideMenuOff()
- {
- GrafPtr desktop;
- short rightEdge, step;
- Rect source, dest;
- RgnHandle saveGray, menuBox;
- Ulong now;
- menuListHand ml;
-
- // An improved hack. Uses the current apps menu list to find the right
- // most menu. - MEA 07/05/94
- ml=(menuListHand)LMGetMenuList();
- rightEdge = (*ml)->nextLeft;
-
- // Need to fool around with the desktop. This is similar to hiding the menu bar.
- GetWMgrPort(&desktop);
- saveGray = NewRgn();
- CopyRgn(GetGrayRgn(), saveGray);
- SetRect(&source, 0, 0, qd.screenBits.bounds.right, LMGetMBarHeight());
- menuBox = NewRgn();
- RectRgn(menuBox, &source);
- UnionRgn(GetGrayRgn(), menuBox, GetGrayRgn());
-
- // OK, now scroll the menu off the screen
- SetRect(&source, 0, 0, rightEdge, LMGetMBarHeight());
- dest = source;
- step = 1;
-
- while (dest.right > 0) {
- OffsetRect(&dest, -step, 0);
- CopyBits(&desktop->portBits,&desktop->portBits, &source, &dest, srcCopy, nil);
-
- // Wait a tick
- now = TickCount();
- while (now == TickCount())
- ;
-
- step <<=1;
- }
-
- // And put things back
- CopyRgn(saveGray, GetGrayRgn());
- DisposeRgn(saveGray);
- DisposeRgn(menuBox);
- }
-
-
-
- struct Matthew: E, Axsom { // chewey@nesw.mv.com
- Matthew(void) : E(), Axsom() {}
- Boolean macSoftwareEngineer(long future) {return future == Random();}
- Boolean newEnglandSoftwareWorks(StringPtr name) {return true;}
- };
-
-
-
-